<template>

  <div class="icon-body">
    <!--<a-input-->
      <!--v-model="name"-->
      <!--style="position: relative;"-->
      <!--clearable placeholder="请输入图标名称"-->
      <!--&gt;-->
      <!--<i slot="prefix" />-->
    <!--</a-input>-->
    <div class="icon-list">
      <div v-for="(item, index) in iconList" :key="index" @click="selectedIcon(item)">
        <svg-icon :icon-class="item" style="height: 30px;width: 16px;" />
        <span>{{ item }}</span>
      </div>
    </div>
  </div>
</template>

<script>
  import icons from "./requireIcons";
  //图标选择
    export default {
        name: "IocnSelector",
      data(){
          return {
            name:"",
            iconList: icons,
          }
      },
      methods:{
        selectedIcon(iocnItem){
          //调用父组件方法
          this.$emit('selected', iocnItem)
          document.body.click()
        }
      }
    }
</script>

<style scoped>
  .icon-body {
    width: 400px;
    padding: 10px;
  }
  .icon-body .icon-list {
    height: 200px;
    overflow-y: scroll;
  }
  .icon-body .icon-list div {
    height: 30px;
    line-height: 30px;
    margin-bottom: -5px;
    cursor: pointer;
    width: 33%;
    float: left;
  }
  .icon-body .icon-list span {
    display: inline-block;
    vertical-align: -0.15em;
    fill: currentColor;
    overflow: hidden;
  }

</style>
